package cn.quickcode.monitor.ui.dialog;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.wb.swt.ResourceManager;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.layout.GridData;
import org.eclipse.wb.swt.SWTResourceManager;

public class CfgDBMDialog extends Dialog
{
	public ViewPart viewPart;
	public Label lblNewLabel;
	public Text txtSessionActive;
	public Label lblNewLabel_1;
	public Text txtTableSpace;
	public Label lblNewLabel_2;
	public Label lblNewLabel_3;
	public CfgDBMDialog(Shell parentShell,ViewPart viewPart)
	{
		super(parentShell);
		this.viewPart = viewPart;
	}
	/**
	 * Create the dialog.
	 * @param parentShell
	 * @wbp.parser.constructor
	 */
	private CfgDBMDialog(Shell parentShell)
	{
		super(parentShell);
	}
	/* (non-Javadoc)
	 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
	 */
	@Override
	protected void configureShell(Shell newShell)
	{
		// TODO Auto-generated method stub
		super.configureShell(newShell);
		newShell.setText("监控参数配置");
		newShell.setImage(ResourceManager.getPluginImage("SuperMonitor", "icons/icon6.gif"));
	}

	/**
	 * Create contents of the dialog.
	 * @param parent
	 */
	@Override
	protected Control createDialogArea(Composite parent)
	{
		Composite container = (Composite) super.createDialogArea(parent);
		GridLayout gl_container = new GridLayout(3, false);
		gl_container.marginLeft = 10;
		gl_container.marginRight = 10;
		gl_container.marginTop = 10;
		container.setLayout(gl_container);
		
		this.lblNewLabel = new Label(container, SWT.NONE);
		this.lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
		this.lblNewLabel.setText("并发连接数：");
		
		this.txtSessionActive = new Text(container, SWT.BORDER);
		this.txtSessionActive.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		
		this.lblNewLabel_2 = new Label(container, SWT.NONE);
		this.lblNewLabel_2.setForeground(SWTResourceManager.getColor(SWT.COLOR_RED));
		this.lblNewLabel_2.setText("* 超过多少进行警告");
		
		this.lblNewLabel_1 = new Label(container, SWT.NONE);
		this.lblNewLabel_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
		this.lblNewLabel_1.setText("可用表空间：");
		
		this.txtTableSpace = new Text(container, SWT.BORDER);
		this.txtTableSpace.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		
		this.lblNewLabel_3 = new Label(container, SWT.NONE);
		this.lblNewLabel_3.setForeground(SWTResourceManager.getColor(SWT.COLOR_RED));
		this.lblNewLabel_3.setText("* 超过多少进行警告");

		return container;
	}

	/**
	 * Create contents of the button bar.
	 * @param parent
	 */
	@Override
	protected void createButtonsForButtonBar(Composite parent)
	{
		createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
		createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
	}

	/**
	 * Return the initial size of the dialog.
	 */
	@Override
	protected Point getInitialSize()
	{
		return new Point(450, 169);
	}

}
